package com.wd.mylibrary_square.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.wd.mylibrary_base.bean.SearchBean
import com.wd.mylibrary_base.utils.HttpUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

/**
 * 作者: 邢凌志
 * 时间: 2024/9/15
 * 描述: SearchViewModel
 */
class SearchViewModel : ViewModel() {
    var searchData= MutableLiveData<SearchBean>()

    fun getSearchData(userId:Int,nickName: String, page:Int, size:Int){
        viewModelScope.launch(Dispatchers.IO) {
            searchData.postValue(HttpUtils.httpUtils.apiService.getSearch(userId,nickName, page, size))
        }
    }
}